package com.mls.fivedistrict.controller.backend;

import com.github.pagehelper.PageInfo;
import com.mls.fivedistrict.common.ServiceResponse;
import com.mls.fivedistrict.controller.BaseController;
import com.mls.fivedistrict.pojo.UserAuthRecord;
import com.mls.fivedistrict.server.UserAuthRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by chenxiuxiang on 2018/4/10.
 */
@RestController
@RequestMapping("/api/manager")
public class UserAuthRecordController extends BaseController {
    @Autowired
    UserAuthRecordService userAuthRecordService;

    @GetMapping("/v1/userAuthRecords")
    public ServiceResponse getUserAuthRecordList() {
        List<UserAuthRecord> userAuthRecord = userAuthRecordService.getUserAuthRecord(getPageFilter());
        PageInfo<UserAuthRecord> userAuthRecordPageInfo = new PageInfo<>(userAuthRecord, 5);
        return ServiceResponse.createSuccessResponse(userAuthRecordPageInfo);
    }
//    @RequestMapping("/v1/userAuth/records/{authId}")
//    public ServiceResponse getUserAuthRecords(@PathVariable("authId")Long authId){
//        PageHelper.startPage(getPageFilter().getPageNum(),getPageFilter().getPageSize());
//        List<UserAuthRecord> userAuthRecordList=userAuthRecordService.getUserAuthRecord(getPageFilter());
//        PageInfo pageInfo=new PageInfo(userAuthRecordList);
//        return ServiceResponse.createSuccessResponse(pageInfo);
//    }
}
